<?php  include VIEWPATH.'common/head.php';  ?>
    <script type="text/javascript">
        var status = '<?php echo $_GET['status'];?>';
        if(status == '-1'){
            alert('fail:<?php echo $_GET['msg'];?>');
        }
        function version_del(id){
            if(!confirm("你确认删除吗？")){
                return false;
            }
            var url = "index.php?c=sys&m=version_del";
            var param = {"id":id};
            common_ajax(url, param, function(data){
                if(data.errorCode == 0) {
                    //表单提交
                    window.location.href=  window.location.href;
                    return true;
                }else{
                    alert(data.errorMsg);
                }
            });
        }
    </script>

    <body class="gray-bg">
    <div class="wrapper wrapper-content">
        <div class="add-btn" style="float:right;">
            <div class="modal fade" id="version_set" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog" role="document" style="width: 60%;"><div class="modal-content"></div></div>
            </div>
        </div>
        <div class="clearfix"></div>
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <a href="index.php?c=sys&m=version_set" class="btn btn-danger" data-toggle="modal" data-target="#version_set">添加</a>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <ul id="myTab" class="nav nav-tabs">
                            <li class="<?php if($_GET['app_id']==1 || empty($_GET['app_id'])){ echo "active";} ?>">
                                <a href="index.php?c=sys&m=version_list&app_id=1">android</a>
                            </li>
                            <li class="<?php if($_GET['app_id']==2){ echo "active";} ?>">
                                <a href="index.php?c=sys&m=version_list&app_id=2">ios</a>
                            </li>
                            <div class="clearfix"></div>
                        </ul>
                        <div id="myTabContent" class="tab-content">
                            <form class="form-horizontal" id="f_form" action="index.php?c=<?php echo $_REQUEST['c'];?>&m=<?php echo $_REQUEST['m'];?>" name="form" method="post">
                                <table class="table table-bordered table-hover">
                                    <thead>
                                    <tr>
                                        <th>名称</th>
                                        <th>设备</th>
                                        <th>大版本号</th>
                                        <th>小版本号</th>
                                        <th>版本标识</th>
                                        <th>是否升级</th>
                                        <th>弹框次数</th>
                                        <th>添加时间</th>
                                        <th></th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php
                                    $app_id = array(1=>"android", 2=>"ios");
                                    $type = array(0=>"不升级", 1 => "升级", 2 => "强制升级");
                                    foreach($vList as $v) {  ?>
                                        <tr>
                                            <td><?php echo $v['title']; ?></td>
                                            <td><?php echo $app_id[$v['app_id']]; ?></td>
                                            <td><?php echo $v["version_id"]; ?></td>
                                            <td><?php echo $v["version_mini"]; ?></td>
                                            <td><?php echo $v["version_code"]; ?></td>
                                            <td><?php echo $type[$v["type"]]; ?></td>
                                            <td><?php echo $v["prompt_num"]; ?></td>
                                            <td><?php echo date("Y-m-d H:i", $v["add_time"]); ?></td>
                                            <td nowrap="nowrap">
                                                <a href="index.php?c=sys&m=version_set&id=<?php echo $v["id"];?>" data-toggle="modal" data-target="#version_set">编辑</a>
                                                <a href="javascript:void(0)" onclick="version_del(<?php echo $v["id"];?>)">删除</a>
                                            </td>
                                        </tr>
                                    <?php }?>
                                    </tbody>
                                </table>
                                <div class="set_page">
                                    <?php echo $multipage;?>
                                    <div class="clearfix"></div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>


<?php  include VIEWPATH.'common/footer.php';  ?>